﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace GameOfLife.Cell
{
    public enum CellState
    {
        Alive = 0,
        Dead
    }

    public class Cell
    {
        private Point position;
        private SolidColorBrush cellColor;
        private static int _size = 10;
        private CellState _currentCellState;
        private CellState _nextCellState;
        private Rectangle rectangle;
        private int index;
        private int cellsAroundCounter;

        public Cell(int x, int y)
        {
            position.X = x;
            position.Y = y;
        }

        public Cell(int x, int y,CellState initCellState)
        {
            position.X = x;
            position.Y = y;
            CurrentCellState = initCellState;
            NextCellState = CellState.Dead;

            rectangle = new Rectangle
            {
                Width = _size,
                Height = _size,
                StrokeThickness = 3
            };

            if (initCellState == CellState.Dead)
                rectangle.Fill = new SolidColorBrush(Colors.White);
            else
            {
                rectangle.Fill = new SolidColorBrush(Colors.Yellow);
            }
        }

        public Point Position
        {
            get { return position; }
            set { position = value; }
        }

        public SolidColorBrush CellColor
        {
            get { return cellColor; }
            set { cellColor = value; }
        }

        public CellState CurrentCellState
        {
            get { return _currentCellState; }
            set { _currentCellState = value; }
        }

        public CellState NextCellState
        {
            get { return _nextCellState; }
            set { _nextCellState = value; }
        }

        public static int Size
        {
            get { return _size; }
            set { _size = value; }
        }

        public Rectangle Rectangle
        {
            get { return rectangle; }
        }

        public int Index
        {
            get { return index; }
            set { index = value; }
        }

        public int CellsAroundCounter
        {
            get { return cellsAroundCounter; }
            set { cellsAroundCounter = value; }
        }
    }
}
